
uniform sampler2D texture;
uniform float w,h;

#define f(a,b,c) gauss[a] * texture2D(texture, textcoord+vec2(b*stepX,c*stepY))

float gauss[5];

void main()
{
gauss[0] = 1.0/273.0;
gauss[1] = 4.0/273.0;
gauss[2] = 7.0/273.0;
gauss[3] = 26.0/273.0;
gauss[4] = 41.0/273.0;

 float stepX = 1.0/w;
 float stepY = 1.0/h;
 vec2 textcoord = vec2(gl_TexCoord[0]);
  
 vec4 returnvec = vec4(0.0,0.0,0.0,0.0);
 
	returnvec +=  f(0,-2.0,2.0)   + f(1,-1.0,2.0)   + f(2,0.0,2.0)  + f(1,1.0,2.0)  + f(0,2.0,2.0)
				 +f(1,-2.0,1.0)   + f(2,-1.0,1.0)   + f(3,0.0,1.0)  + f(2,1.0,1.0)  + f(1,2.0,1.0)
				 +f(2,-2.0,0.0)   + f(3,-1.0,0.0)   + f(4,0.0,0.0)  + f(3,1.0,0.0)  + f(2,2.0,0.0)
				 +f(1,-2.0,-1.0)  + f(2,-1.0,-1.0)  + f(3,0.0,-1.0) + f(2,1.0,-1.0) + f(1,2.0,-1.0)
				 +f(0,-2.0,-2.0)  + f(1,-1.0,-2.0)  + f(2,0.0,-2.0) + f(1,1.0,-2.0) + f(0,2.0,-2.0);
				 

 gl_FragColor = returnvec;
// gl_FragColor = vec4(textcoord,0.0,1.0);
}


/*
// Texture to blur
uniform sampler2D texture;

// textureture size
uniform float w, h;

void main()
{
	float dx = 1.0 / w;
	float dy = 1.0 / h;
	vec2 st = gl_TexCoord[0].st;
	
	// Apply 3x3 gaussian filter
	vec4 color	 = 4.0 * texture2D(texture, st);
	color		+= 2.0 * texture2D(texture, st + vec2(+dx, 0.0));
	color		+= 2.0 * texture2D(texture, st + vec2(-dx, 0.0));
	color		+= 2.0 * texture2D(texture, st + vec2(0.0, +dy));
	color		+= 2.0 * texture2D(texture, st + vec2(0.0, -dy));
	color		+= texture2D(texture, st + vec2(+dx, +dy));
	color		+= texture2D(texture, st + vec2(-dx, +dy));
	color		+= texture2D(texture, st + vec2(-dx, -dy));
	color		+= texture2D(texture, st + vec2(+dx, -dy));
	
	gl_FragColor = color / 16.0;
}
*/
